<?php

namespace app\np\controller;
use app\base\controller\Base;
use think\Request;
use think\Cache;
use think\Config;
use think\Session;


//资金流水日志
class Recharge extends Base
{
    public  $model;

    public function __construct()
    {
   $this->model = model("UsersRecharge");
        parent::__construct();
        $rows = Cache::get($this->Cstatic->get("sid"));
        $this->sid_user_id = $rows['id'];
        $this->sid_mobile = $rows['mobile'];
    }

    /**
     * @return \think\response\Json  询价历史
     */
    public function index()
    {//
        //搜索条件 时间 用户号码
        $where['a.user_id'] =$this->sid_user_id;

        //时间的处理
     $res = $this->model->recharge_page($where);
     return   resJson(1,$this->ecLang("query"),$res['res'],$res['pageInfo']);
    }





    //至今流水详情
    public function read($id){
        $res =  $this->model->where(["id"=>$id])->find();


        if($res){
            $res['mobile'] = $this->sid_mobile;
            $UsersBank = model("UsersBank");
           $d = $UsersBank->where(["id"=>$res['bank_id']])->find();
            $res['bank_name'] = $d['bank_name'] ;
            $res['bank_no'] = $d['bank_no'] ;
            $res['account_name'] = $d['account_name'] ;


            return sucessJson($this->ecLang("detail_yes"),$res->toArray());
        }else{
            return   failJson($this->ecLang("detail_no"));

        }

    }





}
